package com.ruoyi.youtian.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.youtian.domain.EquipmentCategory;
import com.ruoyi.youtian.mapper.EquipmentCategoryMapper;
import com.ruoyi.youtian.service.IEquipmentCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 设备分类Service业务层处理
 *
 * @author ruoyi
 * @date 2022-09-07
 */
@Service
public class EquipmentCategoryServiceImpl implements IEquipmentCategoryService
{
    @Autowired
    private EquipmentCategoryMapper equipmentCategoryMapper;

    /**
     * 查询设备分类
     *
     * @param equipmentCategoryId 设备分类主键
     * @return 设备分类
     */
    @Override
    public EquipmentCategory selectEquipmentCategoryByEquipmentCategoryId(Long equipmentCategoryId)
    {
        return equipmentCategoryMapper.selectEquipmentCategoryByEquipmentCategoryId(equipmentCategoryId);
    }

    /**
     * 查询设备分类列表
     *
     * @param equipmentCategory 设备分类
     * @return 设备分类
     */
    @Override
    public List<EquipmentCategory> selectEquipmentCategoryList(EquipmentCategory equipmentCategory)
    {
        return equipmentCategoryMapper.selectEquipmentCategoryList(equipmentCategory);
    }

    /**
     * 新增设备分类
     *
     * @param equipmentCategory 设备分类
     * @return 结果
     */
    @Override
    public int insertEquipmentCategory(EquipmentCategory equipmentCategory)
    {
        equipmentCategory.setCreateTime(DateUtils.getNowDate());
        return equipmentCategoryMapper.insertEquipmentCategory(equipmentCategory);
    }

    /**
     * 修改设备分类
     *
     * @param equipmentCategory 设备分类
     * @return 结果
     */
    @Override
    public int updateEquipmentCategory(EquipmentCategory equipmentCategory)
    {
        equipmentCategory.setUpdateTime(DateUtils.getNowDate());
        return equipmentCategoryMapper.updateEquipmentCategory(equipmentCategory);
    }

    /**
     * 批量删除设备分类
     *
     * @param equipmentCategoryIds 需要删除的设备分类主键
     * @return 结果
     */
    @Override
    public int deleteEquipmentCategoryByEquipmentCategoryIds(Long[] equipmentCategoryIds)
    {
        return equipmentCategoryMapper.deleteEquipmentCategoryByEquipmentCategoryIds(equipmentCategoryIds);
    }

    /**
     * 删除设备分类信息
     *
     * @param equipmentCategoryId 设备分类主键
     * @return 结果
     */
    @Override
    public int deleteEquipmentCategoryByEquipmentCategoryId(Long equipmentCategoryId)
    {
        return equipmentCategoryMapper.deleteEquipmentCategoryByEquipmentCategoryId(equipmentCategoryId);
    }
}
